<?php

namespace common\models\folder;

use Yii;

/**
 * This is the model class for table "{{%member_account_logs}}".
 *
 * @property string $id
 * @property string $member_id 用户Id
 * @property int $balance
 * @property string $value
 * @property string $model
 * @property string $model_id
 * @property string $auth_token
 * @property string $created_at
 * @property string $updated_at
 * @property string $deleted_at
 * @property string $ip
 * @property string $mark
 */
class MemberAccountLogs extends \common\db\ActiveRecord {

    use \common\traits\Constants;

    CONST STATUS_ACTIVED = 1;
    CONST STATUS_DEFAULT = 0;
    CONST STATUS_DELETED = -1;

    /**
     * 收支类型
     * @var BALANCE_INCOME 1   收入
     * @var BALANCE_EXPEND  -1  支出
     */
    CONST BALANCE_EXPEND = -1;
    CONST BALANCE_INCOME = 1;

    /**
     * @inheritdoc
     */
    public static function tableName() {
        return '{{%member_account_logs}}';
    }

    /**
     * @inheritdoc
     */
    public function rules() {
        return [
            [['member_id', 'balance', 'value', 'model_id', 'created_at', 'updated_at', 'deleted_at'], 'integer'],
            [['model', 'auth_token'], 'required'],
            [['model', 'auth_token', 'ip'], 'string', 'max' => 32],
            [['mark'], 'string', 'max' => 255],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels() {
        return [
            'id' => 'ID',
            'member_id' => '用户Id',
            'balance' => 'Balance',
            'value' => 'Value',
            'model' => 'Model',
            'model_id' => 'Model ID',
            'auth_token' => 'Auth Token',
            'created_at' => 'Created At',
            'updated_at' => 'Updated At',
            'deleted_at' => 'Deleted At',
            'ip' => 'Ip',
            'mark' => 'Mark',
        ];
    }

}
